//
//  ViewController.m
//  tableview的练习
//
//  Created by 何典钊 on 2016/12/10.
//  Copyright © 2016年 hedianzhao. All rights reserved.
//

#import "ViewController.h"
#import "Masonry.h"
#import "QQIndividualityView.h"
@interface ViewController ()<UITableViewDelegate>
@property (nonatomic, weak) UIImageView *imgV;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    [self setupUI];
}
#pragma mark - 代理方法
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
    CGFloat offsetY = scrollView.contentOffset.y;
    CGFloat hegth = -offsetY;
    [_imgV mas_updateConstraints:^(MASConstraintMaker *make) {
        make.height.mas_equalTo(hegth);
    }];
    
}

#pragma mark - 搭建界面
- (void)setupUI
{
    UIImageView *img = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"IMG_0112"]];
    img.contentMode = UIViewContentModeScaleToFill;
    [self.view addSubview:img];
    [img mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.right.equalTo(self.view);
        make.height.offset(180);
    }];
    
    _imgV = img;
    
    UITableView *tb = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain];
    tb.contentInset = UIEdgeInsetsMake(180, 0, 0, 0);
    tb.backgroundColor = [UIColor clearColor];
    QQIndividualityView *V = [[QQIndividualityView alloc] init];
    tb.tableHeaderView = V;
    tb.tableFooterView = [[UIView alloc] init];
    tb.delegate = self;
    [self.view addSubview:tb];
    [tb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.view);
    }];
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
